package uk.ac.aber.Blockmation.FileFilters;

import uk.ac.aber.Blockmation.FileManager;

import java.io.File;

import javax.swing.filechooser.FileFilter;


/**
 * JPG file filter.
 *
 * @author Zuza
 */
public class JpgSavingFilter extends FileFilter implements FileFilterExtension
{
    public JpgSavingFilter()
    {
    }

    public boolean accept(File f)
    {
        if (f.isDirectory())
        {
            return true;
        }

        String extension = FileManager.getExtFromFile(f);

        if (extension != null)
        {
            if (extension.equals("jpg"))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        return false;
    }

    public String getDescription()
    {
        String filterDescription = "JPG file";

        return filterDescription;
    }

    public String getExtension()
    {
        return "jpg";
    }
}
